package com.cloud.util;

import lombok.Data;

/**
 * @author lc
 * @date  2020/4/23
 */
@Data
public class JsonResult {
    private Object msg;
    private int code ;
    private Object data;
    public static JsonResult okMsg(Object msg){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setMsg(msg);
        jsonResult.setCode(0);
        return jsonResult;
    }
    public static JsonResult okData(Object data){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setData(data);
        jsonResult.setCode(0);
        return jsonResult;
    }
    public static JsonResult fail(Object msg){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setMsg(msg);
        jsonResult.setCode(-1);
        return jsonResult;
    }
}